/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "test/unittest/core/pipeline/velocity_tracker_test.h"

using namespace testing;
using namespace testing::ext;

namespace OHOS::Ace::NG {
namespace {
using EventDataInt = std::vector<std::vector<int32_t>>;
using EventDataFloat = std::vector<std::vector<float>>;

EventDataInt sampleData1 = {
    {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}
};

EventDataInt sampleData2 = {
    {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403}
};

EventDataInt sampleData3 = {
    {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
    {135, 5470, 16350}
};

EventDataInt sampleData4 = {
    {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
    {135, 5470, 16350}, {142, 5467, 16284}, {149, 5465, 16225}, {156, 5463, 16163}, {163, 5463, 16113},
    {170, 5463, 16058}, {177, 5463, 16001}, {184, 5463, 15948}, {191, 5461, 15896}, {198, 5461, 15843},
    {205, 5461, 15793}, {212, 5461, 15742}, {219, 5461, 15690}, {226, 5461, 15637}, {233, 5458, 15587},
    {240, 5458, 15532}, {247, 5458, 15480}, {254, 5458, 15425}, {261, 5456, 15372}
};

EventDataInt sampleData5 = {
    {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
    {135, 5470, 16350}, {142, 5467, 16284}, {149, 5465, 16225}, {156, 5463, 16163}, {163, 5463, 16113},
    {170, 5463, 16058}, {177, 5463, 16001}, {184, 5463, 15948}, {191, 5461, 15896}, {198, 5461, 15843},
    {205, 5461, 15793}, {212, 5461, 15742}, {219, 5461, 15690}, {226, 5461, 15637}, {233, 5458, 15587},
    {240, 5458, 15532}, {247, 5458, 15480}, {254, 5458, 15425}, {261, 5456, 15372}, {268, 5456, 15317}
};

EventDataInt sampleData6 = {
    {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
    {135, 5470, 16350}, {142, 5467, 16284}, {149, 5465, 16225}, {156, 5463, 16163}, {163, 5463, 16113},
    {170, 5463, 16058}, {177, 5463, 16001}, {184, 5463, 15948}, {191, 5461, 15896}, {198, 5461, 15843},
    {205, 5461, 15793}, {212, 5461, 15742}, {219, 5461, 15690}, {226, 5461, 15637}, {233, 5458, 15587},
    {240, 5458, 15532}, {247, 5458, 15480}, {254, 5458, 15425}, {261, 5456, 15372}, {268, 5456, 15317},
    {275, 5456, 15267}
};

EventDataInt sampleData7 = {
    {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
    {135, 5470, 16350}, {142, 5467, 16284}, {149, 5465, 16225}, {156, 5463, 16163}, {163, 5463, 16113},
    {170, 5463, 16058}, {177, 5463, 16001}, {184, 5463, 15948}, {191, 5461, 15896}, {198, 5461, 15843}
};

std::vector<EventDataInt> sampleDatas = {
    sampleData1, sampleData2, sampleData3,
    sampleData4, sampleData5, sampleData6,
    sampleData7
};

EventDataInt flagShipLowSpeed1 = {
    {53004, 5479, 16579}, {53087, 5479, 16542}, {53095, 5479, 16497}, {53102, 5476, 16458}, {53110, 5472, 16403},
    {53116, 5470, 16350}, {53124, 5467, 16284}, {53130, 5465, 16225}, {53138, 5463, 16163}, {53145, 5463, 16113},
    {53152, 5463, 16058}, {53159, 5463, 16001}, {53166, 5463, 15948}, {53173, 5461, 15896}, {53181, 5461, 15843},
    {53188, 5461, 15793}, {53196, 5461, 15742}, {53203, 5461, 15690}, {53211, 5461, 15637}, {53218, 5458, 15587},
    {53225, 5458, 15532}, {53232, 5458, 15480}, {53239, 5458, 15425}, {53245, 5456, 15372}, {53253, 5456, 15317},
    {53261, 5456, 15267}, {53268, 5456, 15217}, {53276, 5456, 15162}, {53283, 5456, 15109}, {53290, 5454, 15057},
    {53297, 5454, 15004}, {53304, 5454, 14952}, {53312, 5454, 14897}, {53319, 5452, 14844}, {53326, 5452, 14790},
    {53333, 5449, 14737}, {53341, 5445, 14682}, {53347, 5445, 14627}, {53355, 5445, 14570}
};

EventDataInt flagShipLowSpeed2 = {
    {47556, 5479, 16567}, {47625, 5479, 16561}, {47632, 5479, 16554}, {47639, 5476, 16510}, {47646, 5472, 16455},
    {47653, 5470, 16412}, {47661, 5467, 16366}, {47667, 5465, 16321}, {47675, 5463, 16273}, {47682, 5461, 16236},
    {47689, 5458, 16186}, {47696, 5456, 16135}, {47704, 5454, 16083}, {47711, 5454, 16035}, {47718, 5454, 15980},
    {47725, 5454, 15928}, {47733, 5454, 15873}, {47740, 5452, 15820}, {47748, 5452, 15768}, {47754, 5452, 15717},
    {47762, 5452, 15667}, {47768, 5449, 15612}, {47775, 5449, 15557}, {47783, 5449, 15502}, {47790, 5449, 15448},
    {47797, 5449, 15393}, {47804, 5449, 15338}, {47811, 5447, 15288}, {47819, 5447, 15237}, {47826, 5447, 15183},
    {47833, 5447, 15130}, {47840, 5445, 15077}, {47848, 5445, 15023}, {47856, 5443, 14968}, {47864, 5443, 14913},
    {47870, 5443, 14863}, {47878, 5443, 14808}, {47884, 5443, 14753}, {47892, 5443, 14698}, {47899, 5443, 14643},
    {47906, 5443, 14588}, {47914, 5443, 14522}, {47921, 5443, 14451}
};

EventDataInt flagShipLowSpeed3 = {
    {42651, 5474, 16567}, {42720, 5474, 16565}, {42728, 5474, 16561}, {42735, 5474, 16519}, {42742, 5474, 16471},
    {42749, 5472, 16442}, {42756, 5467, 16401}, {42762, 5465, 16348}, {42769, 5463, 16298}, {42778, 5461, 16259},
    {42785, 5458, 16209}, {42792, 5458, 16158}, {42800, 5458, 16106}, {42806, 5456, 16049}, {42814, 5456, 15992},
    {42821, 5454, 15939}, {42829, 5454, 15889}, {42835, 5454, 15838}, {42842, 5454, 15788}, {42850, 5452, 15736},
    {42858, 5452, 15685}, {42864, 5452, 15633}, {42872, 5452, 15578}, {42879, 5449, 15525}, {42887, 5449, 15470},
    {42894, 5449, 15418}, {42901, 5449, 15363}, {42908, 5447, 15311}, {42916, 5447, 15260}, {42922, 5447, 15205},
    {42930, 5447, 15153}, {42937, 5445, 15100}, {42944, 5445, 15048}, {42952, 5445, 14995}, {42959, 5445, 14940},
    {42966, 5443, 14888}, {42973, 5443, 14833}, {42981, 5443, 14778}, {42988, 5443, 14723}, {42995, 5443, 14664},
    {43002, 5443, 14609}, {43009, 5445, 14545}, {43017, 5445, 14479}
};

EventDataInt flagShipLowSpeed4 = {
    {37198, 5481, 16565}, {37261, 5481, 16561}, {37268, 5481, 16554}, {37276, 5476, 16515}, {37283, 5472, 16460},
    {37289, 5470, 16421}, {37297, 5467, 16382}, {37304, 5465, 16332}, {37311, 5463, 16279}, {37318, 5461, 16241},
    {37325, 5458, 16190}, {37333, 5458, 16140}, {37340, 5458, 16087}, {37346, 5456, 16033}, {37354, 5456, 15980},
    {37362, 5454, 15925}, {37370, 5454, 15870}, {37376, 5452, 15820}, {37384, 5452, 15768}, {37391, 5449, 15715},
    {37398, 5449, 15662}, {37405, 5449, 15610}, {37413, 5449, 15557}, {37420, 5449, 15500}, {37428, 5449, 15445},
    {37434, 5449, 15393}, {37442, 5449, 15338}, {37449, 5447, 15288}, {37456, 5447, 15237}, {37463, 5447, 15183},
    {37470, 5447, 15130}, {37478, 5445, 15077}, {37486, 5445, 15025}, {37492, 5443, 14970}, {37499, 5443, 14915},
    {37507, 5443, 14865}, {37514, 5443, 14815}, {37521, 5443, 14758}, {37529, 5443, 14703}, {37534, 5443, 14648},
    {37542, 5443, 14588}, {37550, 5443, 14524}, {37557, 5443, 14454}
};

EventDataInt flagShipLowSpeed5 = {
    {31499, 5481, 16570}, {31568, 5479, 16540}, {31575, 5474, 16503}, {31582, 5472, 16465}, {31589, 5470, 16417},
    {31597, 5465, 16371}, {31604, 5458, 16321}, {31611, 5458, 16282}, {31618, 5458, 16229}, {31625, 5456, 16172},
    {31633, 5454, 16122}, {31640, 5454, 16069}, {31648, 5454, 16017}, {31654, 5454, 15962}, {31661, 5454, 15907},
    {31669, 5454, 15854}, {31676, 5454, 15802}, {31683, 5452, 15754}, {31691, 5452, 15704}, {31697, 5449, 15649},
    {31705, 5449, 15596}, {31713, 5447, 15544}, {31721, 5447, 15491}, {31727, 5447, 15438}, {31734, 5447, 15384},
    {31741, 5447, 15329}, {31749, 5447, 15274}, {31755, 5447, 15224}, {31763, 5447, 15171}, {31769, 5445, 15119},
    {31777, 5445, 15066}, {31785, 5445, 15013}, {31792, 5445, 14961}, {31799, 5443, 14908}, {31806, 5443, 14853},
    {31814, 5443, 14801}, {31821, 5443, 14746}, {31828, 5443, 14689}, {31836, 5443, 14630}, {31843, 5443, 14572},
    {31850, 5443, 14515}
};

EventDataInt flagShipLowSpeed6 = {
    {26883, 5467, 16574}, {26952, 5467, 16572}, {26959, 5467, 16570}, {26968, 5467, 16533}, {26975, 5467, 16487},
    {26982, 5467, 16451}, {26989, 5467, 16407}, {26996, 5465, 16366}, {27003, 5461, 16316}, {27010, 5461, 16277},
    {27018, 5461, 16227}, {27024, 5458, 16177}, {27032, 5454, 16122}, {27039, 5454, 16071}, {27047, 5454, 16017},
    {27053, 5454, 15960}, {27061, 5454, 15905}, {27068, 5454, 15854}, {27075, 5454, 15804}, {27083, 5452, 15752},
    {27090, 5452, 15697}, {27097, 5452, 15644}, {27105, 5452, 15589}, {27112, 5449, 15537}, {27119, 5449, 15482},
    {27126, 5447, 15427}, {27133, 5447, 15372}, {27140, 5445, 15322}, {27148, 5445, 15269}, {27155, 5445, 15219},
    {27163, 5445, 15169}, {27170, 5443, 15116}, {27177, 5443, 15061}, {27184, 5443, 15007}, {27192, 5443, 14952},
    {27199, 5443, 14897}, {27206, 5443, 14842}, {27213, 5440, 14792}, {27220, 5440, 14737}, {27227, 5440, 14682},
    {27234, 5440, 14627}, {27241, 5443, 14563}, {27249, 5443, 14497}
};

EventDataInt flagShipLowSpeed7 = {
    {22224, 5481, 16570}, {22292, 5481, 16565}, {22300, 5481, 16558}, {22308, 5476, 16522}, {22315, 5472, 16471},
    {22322, 5467, 16430}, {22329, 5465, 16389}, {22337, 5463, 16343}, {22344, 5461, 16293}, {22351, 5461, 16257},
    {22359, 5461, 16206}, {22365, 5458, 16154}, {22373, 5454, 16099}, {22379, 5454, 16046}, {22386, 5454, 15992},
    {22394, 5452, 15937}, {22402, 5452, 15884}, {22409, 5452, 15834}, {22417, 5452, 15784}, {22424, 5449, 15731},
    {22431, 5449, 15681}, {22438, 5449, 15626}, {22445, 5449, 15571}, {22453, 5447, 15516}, {22460, 5447, 15461},
    {22467, 5447, 15407}, {22475, 5447, 15352}, {22481, 5445, 15299}, {22488, 5445, 15249}, {22495, 5443, 15194},
    {22503, 5443, 15141}, {22510, 5443, 15089}, {22517, 5443, 15036}, {22525, 5443, 14984}, {22532, 5443, 14931},
    {22539, 5440, 14879}, {22547, 5440, 14826}, {22554, 5440, 14774}, {22562, 5440, 14719}, {22567, 5440, 14662},
    {22575, 5440, 14602}, {22582, 5443, 14545}, {22589, 5447, 14479}
};

EventDataInt flagShipLowSpeed8 = {
    {16574, 5490, 16570}, {16643, 5488, 16561}, {16650, 5483, 16551}, {16656, 5481, 16529}, {16664, 5479, 16492},
    {16671, 5472, 16419}, {16678, 5470, 16371}, {16685, 5467, 16327}, {16693, 5465, 16279}, {16700, 5463, 16243},
    {16707, 5461, 16197}, {16715, 5461, 16149}, {16722, 5461, 16097}, {16729, 5458, 16039}, {16736, 5458, 15987},
    {16744, 5456, 15934}, {16751, 5456, 15882}, {16757, 5456, 15829}, {16764, 5456, 15777}, {16772, 5454, 15726},
    {16779, 5454, 15676}, {16787, 5452, 15619}, {16794, 5452, 15564}, {16801, 5449, 15509}, {16809, 5449, 15454},
    {16816, 5449, 15402}, {16823, 5449, 15349}, {16830, 5449, 15297}, {16837, 5449, 15244}, {16845, 5449, 15192},
    {16852, 5449, 15139}, {16861, 5447, 15087}, {16868, 5447, 15034}, {16873, 5447, 14981}, {16880, 5447, 14927},
    {16888, 5445, 14874}, {16896, 5445, 14819}, {16902, 5445, 14767}, {16910, 5445, 14712}, {16917, 5445, 14655},
    {16924, 5445, 14595}, {16931, 5445, 14531}, {16939, 5445, 14465}
};

EventDataInt flagShipLowSpeed9 = {
    {10881, 5481, 16570}, {10950, 5481, 16565}, {10957, 5481, 16558}, {10965, 5479, 16524}, {10972, 5474, 16478},
    {10979, 5472, 16430}, {10986, 5470, 16380}, {10993, 5467, 16334}, {11000, 5465, 16291}, {11008, 5465, 16254},
    {11015, 5465, 16204}, {11021, 5463, 16151}, {11029, 5458, 16097}, {11036, 5458, 16044}, {11044, 5458, 15992},
    {11051, 5456, 15937}, {11058, 5456, 15884}, {11065, 5456, 15832}, {11072, 5456, 15779}, {11080, 5454, 15729},
    {11088, 5454, 15678}, {11094, 5452, 15621}, {11101, 5452, 15566}, {11108, 5452, 15514}, {11115, 5452, 15459},
    {11123, 5452, 15404}, {11131, 5452, 15349}, {11138, 5449, 15299}, {11146, 5449, 15249}, {11152, 5449, 15194},
    {11160, 5449, 15141}, {11168, 5447, 15089}, {11175, 5447, 15036}, {11181, 5447, 14984}, {11188, 5447, 14929},
    {11198, 5447, 14874}, {11205, 5447, 14819}, {11210, 5447, 14767}, {11217, 5447, 14712}, {11225, 5447, 14657},
    {11232, 5447, 14598}, {11239, 5447, 14536}, {11247, 5447, 14470}
};

EventDataInt flagShipLowSpeed10 = {
    {6437, 5481, 16567}, {6507, 5479, 16545}, {6515, 5476, 16519}, {6521, 5474, 16478}, {6529, 5472, 16428},
    {6535, 5467, 16385}, {6543, 5461, 16334}, {6550, 5461, 16295}, {6557, 5461, 16243}, {6565, 5458, 16183},
    {6572, 5456, 16131}, {6579, 5456, 16078}, {6586, 5456, 16026}, {6592, 5456, 15971}, {6600, 5456, 15921},
    {6607, 5456, 15868}, {6615, 5456, 15818}, {6623, 5454, 15768}, {6630, 5454, 15717}, {6637, 5454, 15667},
    {6644, 5454, 15614}, {6652, 5452, 15560}, {6659, 5452, 15505}, {6665, 5452, 15452}, {6673, 5452, 15397},
    {6681, 5449, 15345}, {6688, 5449, 15295}, {6695, 5449, 15240}, {6702, 5449, 15187}, {6709, 5447, 15135},
    {6717, 5447, 15082}, {6724, 5447, 15029}, {6731, 5447, 14975}, {6738, 5445, 14922}, {6745, 5445, 14867},
    {6752, 5445, 14815}, {6759, 5445, 14760}, {6767, 5445, 14703}, {6774, 5445, 14643}, {6783, 5445, 14586},
    {6790, 5445, 14529}
};

std::vector<EventDataInt> flagShipLowSpeedDatas = {
    flagShipLowSpeed1, flagShipLowSpeed2, flagShipLowSpeed3, flagShipLowSpeed4, flagShipLowSpeed5,
    flagShipLowSpeed6, flagShipLowSpeed7, flagShipLowSpeed8, flagShipLowSpeed9, flagShipLowSpeed10
};

EventDataFloat justPans1 = {
    {1225602910000, 934.125000, 1819.000000}, {1225609796000, 934.125000, 1819.000000},
    {1225615079000, 952.750000, 1774.750000}, {1225621657000, 975.875000, 1719.750000},
    {1225627576000, 999.000000, 1669.750000}, {1225634524000, 1029.250000, 1604.875000},
    {1225640754000, 1051.250000, 1582.375000}, {1225647327000, 1085.625000, 1550.750000},
    {1225653292000, 1085.625000, 1550.750000}
};

EventDataFloat justPans2 = {
    {1435133099000, 947.125000, 1873.375000}, {1435138362000, 947.125000, 1873.375000},
    {1435145646000, 947.125000, 1873.375000}, {1435152440000, 947.125000, 1873.375000},
    {1435158860000, 947.125000, 1870.625000}, {1435165623000, 947.125000, 1867.500000},
    {1435172735000, 949.375000, 1845.750000}, {1435179593000, 952.500000, 1815.000000},
    {1435185979000, 959.875000, 1774.125000}, {1435192802000, 969.750000, 1723.375000},
    {1435199055000, 984.625000, 1683.000000}, {1435205968000, 1006.375000, 1632.000000},
    {1435212773000, 1032.000000, 1576.375000}, {1435219400000, 1057.750000, 1528.250000},
    {1435225848000, 1089.875000, 1460.250000}, {1435232596000, 1118.375000, 1401.875000},
    {1435238772000, 1140.875000, 1358.375000}, {1435245716000, 1164.625000, 1314.125000},
    {1435253518000, 1168.000000, 1287.875000}, {1435260417000, 1170.250000, 1251.000000},
    {1435265404000, 1170.250000, 1251.000000}
};

EventDataFloat justPans3 = {
    {1620886380000, 918.875000, 2044.875000}, {1620893718000, 918.875000, 2044.875000},
    {1620898368000, 918.875000, 2044.875000}, {1620905149000, 918.875000, 2044.875000},
    {1620911165000, 919.250000, 2035.875000}, {1620918177000, 919.250000, 2024.625000},
    {1620924082000, 925.125000, 1990.125000}, {1620930688000, 933.625000, 1938.875000},
    {1620937525000, 942.625000, 1884.125000}, {1620944341000, 950.500000, 1836.750000},
    {1620950741000, 961.750000, 1780.000000}, {1620957415000, 974.500000, 1718.250000},
    {1620964743000, 991.375000, 1688.125000}, {1620971639000, 1019.125000, 1643.250000},
    {1620977195000, 1019.125000, 1643.250000}
};

EventDataFloat justPans4 = {
    {1693508313000, 876.625000, 2081.250000}, {1693515364000, 876.625000, 2081.250000},
    {1693520533000, 878.875000, 2075.000000}, {1693527316000, 881.625000, 2067.500000},
    {1693533422000, 891.250000, 2018.375000}, {1693540211000, 906.000000, 1944.250000},
    {1693546719000, 924.000000, 1898.750000}, {1693553516000, 947.750000, 1850.250000},
    {1693560792000, 979.250000, 1774.375000}, {1693567558000, 1004.125000, 1716.875000},
    {1693573720000, 1029.500000, 1689.500000}, {1693580515000, 1072.125000, 1647.750000},
    {1693585880000, 1072.125000, 1647.750000}
};

EventDataFloat justPans5 = {
    {2099916684000, 961.500000, 1771.625000}, {2099923688000, 961.500000, 1771.625000},
    {2099928177000, 995.375000, 1698.500000}, {2099934888000, 1037.375000, 1608.000000},
    {2099943214000, 1065.625000, 1576.375000}, {2099949954000, 1111.375000, 1525.625000},
    {2099953559000, 1111.375000, 1525.625000}
};

EventDataFloat justPans6 = {
    {2160394432000, 930.750000, 1906.125000}, {2160401230000, 930.750000, 1906.125000},
    {2160406116000, 930.750000, 1906.125000}, {2160412802000, 930.750000, 1906.125000},
    {2160419336000, 930.750000, 1906.125000}, {2160426294000, 930.750000, 1906.125000},
    {2160432188000, 932.500000, 1898.500000}, {2160438886000, 934.375000, 1889.750000},
    {2160445899000, 939.500000, 1875.625000}, {2160452792000, 947.125000, 1854.250000},
    {2160458695000, 959.000000, 1827.125000}, {2160465382000, 973.375000, 1795.875000},
    {2160472331000, 988.625000, 1761.125000}, {2160479137000, 1002.750000, 1729.250000},
    {2160485765000, 1014.000000, 1705.375000}, {2160492527000, 1026.625000, 1680.000000},
    {2160499030000, 1040.250000, 1657.375000}, {2160505930000, 1055.750000, 1633.625000},
    {2160512692000, 1073.250000, 1608.250000}, {2160519333000, 1091.250000, 1584.375000},
    {2160525234000, 1108.250000, 1559.500000}, {2160532110000, 1122.375000, 1538.875000},
    {2160538897000, 1131.375000, 1523.750000}, {2160545523000, 1139.750000, 1509.000000},
    {2160551745000, 1139.750000, 1509.000000}
};

EventDataFloat justPans7 = {
    {2190471483000, 920.000000, 2039.500000}, {2190478391000, 920.000000, 2039.500000},
    {2190483214000, 920.875000, 2037.875000}, {2190490132000, 922.000000, 2035.875000},
    {2190495775000, 926.250000, 2018.625000}, {2190502659000, 933.250000, 1990.750000},
    {2190509243000, 948.250000, 1936.625000}, {2190516142000, 961.500000, 1888.375000},
    {2190522568000, 975.875000, 1856.750000}, {2190529704000, 994.750000, 1817.625000},
    {2190535779000, 1018.750000, 1761.125000}, {2190542446000, 1042.500000, 1707.000000},
    {2190548752000, 1060.875000, 1687.000000}, {2190555535000, 1088.500000, 1661.625000},
    {2190562387000, 1088.500000, 1661.625000}
};

EventDataFloat justPans8 = {
    {2328148688000, 902.875000, 1989.875000}, {2328155719000, 902.875000, 1989.875000},
    {2328160307000, 904.250000, 1977.750000}, {2328167277000, 905.625000, 1963.625000},
    {2328173458000, 916.625000, 1932.125000}, {2328180350000, 934.750000, 1879.000000},
    {2328186775000, 960.625000, 1813.875000}, {2328193475000, 984.125000, 1761.500000},
    {2328200560000, 1004.375000, 1731.500000}, {2328207376000, 1032.625000, 1695.750000},
    {2328212806000, 1032.625000, 1695.750000}
};

EventDataFloat justPans9 = {
    {2555863772000, 904.875000, 1899.000000}, {2555870635000, 904.875000, 1899.000000},
    {2555875516000, 913.875000, 1877.875000}, {2555882362000, 925.125000, 1851.375000},
    {2555888643000, 950.500000, 1797.000000}, {2555895362000, 982.625000, 1727.875000},
    {2555903142000, 1002.750000, 1691.250000}, {2555909853000, 1027.000000, 1648.625000},
    {2555915531000, 1051.250000, 1614.250000}, {2555922056000, 1078.875000, 1578.625000},
    {2555928571000, 1099.125000, 1546.000000}, {2555935123000, 1112.750000, 1522.500000},
    {2555941038000, 1112.750000, 1522.500000}
};

EventDataFloat justPans10 = {
    {2637406993000, 862.750000, 1984.500000}, {2637412646000, 862.750000, 1984.500000},
    {2637418800000, 862.750000, 1984.500000}, {2637425566000, 862.750000, 1984.500000},
    {2637431722000, 865.375000, 1963.375000}, {2637438512000, 868.125000, 1936.875000},
    {2637445718000, 882.000000, 1892.875000}, {2637452387000, 903.625000, 1824.625000},
    {2637458706000, 928.750000, 1753.000000}, {2637465501000, 950.750000, 1696.000000},
    {2637471620000, 973.625000, 1664.125000}, {2637478596000, 1008.125000, 1622.625000},
    {2637485152000, 1061.375000, 1546.250000}, {2637491947000, 1089.250000, 1504.500000},
    {2637497933000, 1105.125000, 1469.500000}, {2637504758000, 1121.750000, 1428.000000},
    {2637511237000, 1121.750000, 1428.000000}
};

EventDataFloat justPans11 = {
    {2741534377000, 919.750000, 2012.750000}, {2741541325000, 919.750000, 2012.750000},
    {2741545886000, 919.750000, 2012.750000}, {2741552687000, 919.750000, 2012.750000},
    {2741558934000, 921.125000, 2002.500000}, {2741565662000, 922.875000, 1990.750000},
    {2741572099000, 934.375000, 1949.500000}, {2741578858000, 950.750000, 1888.625000},
    {2741585266000, 970.500000, 1833.875000}, {2741591884000, 993.125000, 1776.125000},
    {2741598776000, 1013.125000, 1735.250000}, {2741605638000, 1037.125000, 1692.000000},
    {2741612064000, 1063.375000, 1652.500000}, {2741618747000, 1093.250000, 1614.250000},
    {2741625551000, 1105.375000, 1585.750000}, {2741632475000, 1112.125000, 1560.000000},
    {2741638346000, 1112.125000, 1560.000000}
};

EventDataFloat justPans12 = {
    {2772291397000, 867.875000, 2055.875000}, {2772298378000, 867.875000, 2055.875000},
    {2772302996000, 867.875000, 2055.875000}, {2772309847000, 867.875000, 2055.875000},
    {2772315783000, 868.125000, 2054.125000}, {2772322456000, 868.375000, 2052.250000},
    {2772329395000, 873.500000, 2029.375000}, {2772336281000, 880.250000, 1997.750000},
    {2772342369000, 890.750000, 1952.125000}, {2772349296000, 902.875000, 1899.875000},
    {2772355782000, 914.125000, 1874.250000}, {2772362566000, 929.625000, 1841.500000},
    {2772369044000, 946.250000, 1796.625000}, {2772375792000, 958.375000, 1764.250000},
    {2772382366000, 973.125000, 1738.250000}, {2772389138000, 992.000000, 1707.875000},
    {2772395685000, 1008.375000, 1677.375000}, {2772402307000, 1020.250000, 1656.750000},
    {2772408557000, 1025.875000, 1650.250000}, {2772415113000, 1031.500000, 1646.875000},
    {2772421479000, 1031.500000, 1646.875000}
};

EventDataFloat justPans13 = {
    {2772291397000, 818.875000, 307.875000}, {2772298378000, 818.875000, 307.875000},
    {2772302996000, 818.875000, 307.875000}, {2772309847000, 818.875000, 307.875000},
    {2772315783000, 819.125000, 306.125000}, {2772322456000, 819.375000, 304.250000},
    {2772329395000, 824.500000, 281.375000}, {2772336281000, 831.250000, 249.750000},
    {2772342369000, 841.750000, 204.125000}
};

EventDataFloat justPans14 = {
    {2772291397000, 867.875000, 2057.875000}, {2772298378000, 867.875000, 2057.875000},
    {2772302996000, 867.875000, 2057.875000}, {2772309847000, 867.875000, 2057.875000},
    {2772315783000, 868.125000, 2056.125000}, {2772322456000, 868.375000, 2054.250000},
    {2772329395000, 873.500000, 2031.375000}, {2772421479000, 1031.500000, 1648.875000}
};

EventDataFloat justPans15 = {
    {2827614083000, 852.625000, 2034.375000}, {2827619527000, 852.625000, 2034.375000},
    {2827626733000, 852.625000, 2034.375000}, {2827633448000, 852.625000, 2034.375000},
    {2827639919000, 855.750000, 2026.500000}, {2827646714000, 859.375000, 2016.875000},
    {2827653367000, 867.000000, 1988.500000}, {2827660295000, 878.250000, 1945.875000},
    {2827666564000, 890.750000, 1889.500000}, {2827673419000, 903.625000, 1826.875000},
    {2827680286000, 918.375000, 1800.625000}, {2827687011000, 940.625000, 1766.500000},
    {2827693121000, 940.625000, 1766.500000}
};

EventDataFloat justPans16 = {
    {2827614083000, 852.625000, 2036.375000}, {2827619527000, 852.625000, 2036.375000},
    {2827626733000, 852.625000, 2036.375000}, {2827633448000, 852.625000, 2036.375000},
    {2827639919000, 855.750000, 2028.500000}, {2827693121000, 940.625000, 1768.500000}
};

EventDataFloat justPans17 = {
    {2859372351000, 907.375000, 1867.125000}, {2859379266000, 907.375000, 1867.125000},
    {2859384118000, 907.375000, 1867.125000}, {2859391033000, 907.375000, 1867.125000},
    {2859396990000, 912.375000, 1852.250000}, {2859403682000, 918.375000, 1834.750000},
    {2859410345000, 935.000000, 1787.125000}, {2859417152000, 957.000000, 1724.500000},
    {2859423651000, 969.375000, 1689.500000}, {2859430391000, 984.375000, 1647.750000},
    {2859437171000, 999.625000, 1604.625000}, {2859444058000, 1014.250000, 1563.125000},
    {2859449867000, 1025.500000, 1553.000000}, {2859456577000, 1044.125000, 1539.125000},
    {2859462473000, 1044.125000, 1539.125000}
};

EventDataFloat justPans18 = {
    {2859372351000, 858.375000, 81.125000}, {2859379266000, 858.375000, 81.125000},
    {2859384118000, 858.375000, 81.125000}, {2859391033000, 858.375000, 81.125000},
    {2859396990000, 863.375000, 66.250000}, {2859403682000, 869.375000, 48.750000},
    {2859410345000, 886.000000, 1.125000}
};

EventDataFloat justPans19 = {
    {2859372351000, 907.375000, 1871.125000}, {2859379266000, 907.375000, 1871.125000},
    {2859384118000, 907.375000, 1871.125000}, {2859391033000, 907.375000, 1871.125000},
    {2859396990000, 912.375000, 1856.250000}, {2859462473000, 1044.125000, 1543.125000}
};

EventDataFloat justPans20 = {
    {2929004224000, 856.625000, 1954.625000}, {2929009553000, 856.625000, 1954.625000},
    {2929016223000, 856.625000, 1954.625000}, {2929024108000, 856.625000, 1954.625000},
    {2929029693000, 856.625000, 1954.625000}, {2929036413000, 856.625000, 1954.625000},
    {2929043214000, 863.875000, 1927.500000}, {2929050095000, 872.625000, 1894.250000},
    {2929056753000, 883.125000, 1851.125000}, {2929063484000, 896.125000, 1798.125000},
    {2929069655000, 910.125000, 1767.375000}, {2929076472000, 929.625000, 1727.000000},
    {2929082915000, 954.500000, 1669.250000}, {2929089741000, 978.125000, 1616.125000},
    {2929096256000, 997.625000, 1589.125000}, {2929103015000, 1023.625000, 1557.250000},
    {2929109082000, 1023.625000, 1557.250000}
};

EventDataFloat justPans21 = {
    {2929004224000, 856.625000, 1956.625000}, {2929009553000, 856.625000, 1956.625000},
    {2929016223000, 856.625000, 1956.625000}, {2929024108000, 856.625000, 1956.625000},
    {2929029693000, 856.625000, 1956.625000}, {2929036413000, 856.625000, 1956.625000},
    {2929109082000, 1023.625000, 1559.250000}
};

std::vector<EventDataFloat> justPanDatas = {
    justPans1, justPans2, justPans3, justPans4, justPans5, justPans6, justPans7,
    justPans8, justPans9, justPans10, justPans11, justPans12, justPans13, justPans14,
    justPans15, justPans16, justPans17, justPans18, justPans19, justPans20, justPans21
};
}

/**
 * @tc.name: sampleDatas1
 * @tc.desc: Test UpdateVelocity
 * @tc.type: FUNC
 */
HWTEST_F(VelocityTrackerTest, sampleDatas1, TestSize.Level1)
{
    SystemProperties::velocityTrackerPointNumber_ = 5;
    SystemProperties::isVelocityWithinTimeWindow_ = false;
    SystemProperties::isVelocityWithoutUpPoint_ = false;
    VelocityTracker velocityTracker;
    for (auto cnt = 0; cnt < sampleDatas.size(); ++cnt) {
        velocityTracker.Reset();
        for (auto i = 0; i < sampleDatas[cnt].size(); ++i) {
            std::vector<int32_t> point = sampleDatas[cnt][i];
            std::chrono::microseconds microseconds(point[0] * RATIO_MS_TO_US);
            TimeStamp timeStamp(microseconds);
            TouchEvent touchEvent;
            touchEvent.x = point[1] / TO_TRUE_DATA;
            touchEvent.y = point[2] / TO_TRUE_DATA;
            touchEvent.time = timeStamp;
            float range = TOUCH_STILL_THRESHOLD;
            bool end = false;
            if (i == sampleDatas[cnt].size() - 1)
                end = true;
            velocityTracker.UpdateTouchPoint(touchEvent, end, range);
        }
        velocityTracker.UpdateVelocity();
    }
    EXPECT_EQ(velocityTracker.velocity_.GetVelocityX(), 0.0);
}

/**
 * @tc.name: sampleDatas2
 * @tc.desc: Test UpdateVelocity
 * @tc.type: FUNC
 */
HWTEST_F(VelocityTrackerTest, sampleDatas2, TestSize.Level1)
{
    SystemProperties::velocityTrackerPointNumber_ = 20;
    SystemProperties::isVelocityWithinTimeWindow_ = true;
    SystemProperties::isVelocityWithoutUpPoint_ = true;
    VelocityTracker velocityTracker;
    for (auto cnt = 0; cnt < sampleDatas.size(); ++cnt) {
        velocityTracker.Reset();
        for (auto i = 0; i < sampleDatas[cnt].size(); ++i) {
            std::vector<int32_t> point = sampleDatas[cnt][i];
            std::chrono::microseconds microseconds(point[0] * RATIO_MS_TO_US);
            TimeStamp timeStamp(microseconds);
            TouchEvent touchEvent;
            touchEvent.sourceType = SourceType::TOUCH;
            touchEvent.x = point[1] / TO_TRUE_DATA;
            touchEvent.y = point[2] / TO_TRUE_DATA;
            touchEvent.time = timeStamp;
            float range = TOUCH_STILL_THRESHOLD;
            bool end = false;
            if (i == sampleDatas[cnt].size() - 1)
                end = true;
            velocityTracker.UpdateTouchPoint(touchEvent, end, range);
        }
        velocityTracker.UpdateVelocity();
    }
    EXPECT_NE(velocityTracker.velocity_.GetVelocityX(), 0.0);
}

/**
 * @tc.name: flagShipLowSpeedDatas
 * @tc.desc: Test UpdateVelocity
 * @tc.type: FUNC
 */
HWTEST_F(VelocityTrackerTest, flagShipLowSpeedDatas, TestSize.Level1)
{
    SystemProperties::velocityTrackerPointNumber_ = 5;
    SystemProperties::isVelocityWithinTimeWindow_ = false;
    SystemProperties::isVelocityWithoutUpPoint_ = false;
    VelocityTracker velocityTracker;
    for (auto cnt = 0; cnt < flagShipLowSpeedDatas.size(); ++cnt) {
        velocityTracker.Reset();
        for (auto i = 0; i < flagShipLowSpeedDatas[cnt].size(); ++i) {
            std::vector<int32_t> point = flagShipLowSpeedDatas[cnt][i];
            std::chrono::microseconds microseconds(point[0] * RATIO_MS_TO_US);
            TimeStamp timeStamp(microseconds);
            TouchEvent touchEvent;
            touchEvent.x = point[1] / TO_TRUE_DATA;
            touchEvent.y = point[2] / TO_TRUE_DATA;
            touchEvent.time = timeStamp;
            float range = TOUCH_STILL_THRESHOLD;
            bool end = false;
            if (i == flagShipLowSpeedDatas[cnt].size() - 1)
                end = true;
            velocityTracker.UpdateTouchPoint(touchEvent, end, range);
        }
        velocityTracker.UpdateVelocity();
    }
    EXPECT_NE(velocityTracker.velocity_.GetVelocityX(), 0.0);
}

/**
 * @tc.name: justPanDatas
 * @tc.desc: Test UpdateVelocity
 * @tc.type: FUNC
 */
HWTEST_F(VelocityTrackerTest, justPanDatas, TestSize.Level1)
{
    SystemProperties::velocityTrackerPointNumber_ = 20;
    SystemProperties::isVelocityWithinTimeWindow_ = true;
    SystemProperties::isVelocityWithoutUpPoint_ = true;
    VelocityTracker velocityTracker;
    for (auto cnt = 0; cnt < justPanDatas.size(); ++cnt) {
        velocityTracker.Reset();
        for (auto i = 0; i < justPanDatas[cnt].size(); ++i) {
            std::vector<float> point = justPanDatas[cnt][i];
            std::chrono::microseconds microseconds(static_cast<int64_t>(point[0] / RATIO_NS_TO_US));
            TimeStamp timeStamp(microseconds);
            TouchEvent touchEvent;
            touchEvent.sourceType = SourceType::TOUCH;
            touchEvent.x = point[1];
            touchEvent.y = point[2];
            touchEvent.time = timeStamp;
            float range = TOUCH_STILL_THRESHOLD;
            bool end = false;
            if (i == justPanDatas[cnt].size() - 1)
                end = true;
            velocityTracker.UpdateTouchPoint(touchEvent, end, range);
        }
        velocityTracker.UpdateVelocity();
    }
    EXPECT_NE(velocityTracker.velocity_.GetVelocityX(), 0.0);
}

/**
 * @tc.name: velcoityTrackerEndPointTest001
 * @tc.desc: Test UpdateTouchPoint
 * @tc.type: FUNC
 */
HWTEST_F(VelocityTrackerTest, velcoityTrackerEndTest001, TestSize.Level1)
{
    SystemProperties::velocityTrackerPointNumber_ = 20;
    SystemProperties::isVelocityWithinTimeWindow_ = false;
    SystemProperties::isVelocityWithoutUpPoint_ = false;
    VelocityTracker velocityTracker;
    std::vector<int32_t> timeStampList = { 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000 };
    std::vector<SourceType> sourceTypeList = { SourceType::TOUCH, SourceType::TOUCH, SourceType::NONE,
        SourceType::NONE, SourceType::TOUCH, SourceType::TOUCH, SourceType::NONE, SourceType::NONE };
    std::vector<bool> isEndList = { false, true, false, true, false, true, false, true };
    for (auto i = 0; i < timeStampList.size(); ++i) {
        if (i == 4) {
            SystemProperties::isVelocityWithoutUpPoint_ = true;
        }
        std::chrono::microseconds microseconds(static_cast<int64_t>(timeStampList[i] * RATIO_MS_TO_US));
        TimeStamp timeStamp(microseconds);
        TouchEvent touchEvent;
        touchEvent.id = i;
        touchEvent.time = timeStamp;
        touchEvent.sourceType = sourceTypeList[i];
        velocityTracker.UpdateTouchPoint(touchEvent, isEndList[i], TOUCH_STILL_THRESHOLD);
    }
    EXPECT_EQ(velocityTracker.xAxis_.GetTrackNum(), 7);
}
} // namespace OHOS::Ace::NG
